'''
----案例：QQ群类----
编写一个QQ群类：
属性：群号、群名、成员、群暗号
方法：显示群号、显示群名、显示群成员、出示群暗号、添加群成员、移除群成员
'''


class QQGroup:
    def __init__(self, id, name, members, signal):
        self.id = id
        self.name = name
        self.members_list = members
        self.signal = signal

    def get_id(self):
        return self.id

    def get_name(self):
        return self.name

    def get_members(self):
        return self.members_list

    def show_signal(self):
        tag = 0
        pwd = input('请出示你的暗号：')
        if pwd == self.signal:
            tag = 1
        return tag

    def add_member(self):
        tag = self.show_signal()
        if tag == 1:
            name = input('请输入新成员名字：')
            self.members_list.append(name)
        print(self.members_list)

    def del_member(self):
        msg = 0
        tag = self.show_signal()
        if tag == 1:
            name = input('请输入移除成员名字：')
            for member in self.members_list:
                if name == member:
                    msg = 1
                    self.members_list.remove(member)
                    print(self.members_list)
            if msg == 0:
                print('成员不存在')


    if __name__ == '__main__':
    qq1 = QQGroup(1, '牛人群', ['zhang', 'li'], '123')

    print(qq1.get_id())
    print(qq1.get_name())
    print(qq1.get_members())
    # print(qq1.show_signal())
    # qq1.add_member()
    qq1.del_member()
